home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / music4c.sit / Music4C Folder / Sources Folder / report.c < prev    next >
Text File  |  1990-06-08  |  1KB  |  53 lines

  1. /*
  2. * ⌐ Graeme Gerrard 1990
  3. * Faculty of Music, University of Melbourne
  4. * Parkville Victoria 3052 Australia.
  5. *
  6. * ARPANET: grae@murdu.ucs.unimelb.edu.au
  7. * telephone: (613) 344 4127, Fax: (613) 344 5346
  8. */
  9.  
  10.  
  11. #include    "Music4C.h"
  12. #include    "Music4C_Prototype.h"
  13. #include    <string.h>
  14.  
  15. static        long        reportLen = 0L;
  16. static        char    reportMess[MAXSTRING];
  17. extern        int        ReportFileRefNum;
  18. extern        OSErr    theErr;
  19. extern    Str255    theMess1;
  20.  
  21.  
  22.  
  23. void    Report(theMess)
  24.     char *theMess;
  25. {
  26.     int    messLen;
  27.     
  28.     messLen = strlen(theMess);
  29.     if ( (reportLen + messLen) >= MAXSTRING) {
  30.         if ( reportLen > 0 )
  31.             theErr = FSWrite(ReportFileRefNum, &reportLen, (char *)reportMess);
  32.         reportMess[0] = '\0';
  33.         reportLen = 0L;
  34.         strcpy((char *)reportMess, theMess);
  35.     }
  36.     else {
  37.         strcat((char *)reportMess, theMess);
  38.     }
  39.     reportLen = (long)strlen(reportMess);
  40.     if ( reportMess[reportLen-1] == '\n' ) {
  41.         reportMess[reportLen-1] = '\r';    /* sub 'newline' for 'return' */
  42.         if ( reportLen > 0 )
  43.             theErr = FSWrite(ReportFileRefNum, &reportLen, (char *)reportMess);
  44.             if ( theErr != noErr ) {
  45.                 NumToString(theErr, &theMess1);
  46.                 ParamText("\pProblem writing to Report file", theMess1, NIL, NIL);
  47.                 A_ErrorAlert();
  48.             }
  49.         reportMess[0] = '\0';
  50.         reportLen = 0L;
  51.     }
  52. }
  53.